Node.js Installation

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

Node.js is a JavaScript-based platform, is an increasingly popular, lightweight, and efficient option for developers. It allows coders to use JavaScript on both the front-end and the back-end thanks to Google’s awesome V8 engine.

Installation

-Install Xcode.

-Install git.

-Run the following commands:

git clone git://github.com/ry/node.git cd node ./configure make sudo make install

Debian (Ubuntu/ Mint)

With Aptitude package manager one can install the package nodeJS then edit their bash config to redirect the command node to node js. sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm nano (edit / vim) the file ~/.bashrc and add the line: alias node="nodejs"

Redhat (Fedora / CentOs)

Simply install from official repos: sudo yum install nodejs npm If that fails, enable EPEL repo:

curl --silent --location https://rpm.nodesource.com/setup | bash -

Then simply install from repo:

yum -y install nodejs 

Gentoo

In portage tree:

emerge nodejs

Archlinux

In official repo use pacman package manager:

pacman -S nodejs npm

Linux from source

-Install the dependencies ( Below example using debian apptitude package manager): g++ curl libssl-dev apache2-utils git-core build-essential

sudo apt-get install g++ curl libssl-dev apache2-utils git-core build-essential

  -Run the following commands:

git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

Interested in mastering Node.js Training? Enroll now for FREE demo on Node.js Training.

Windows

Currently, you must use cygwin to install node. To do so, follow these steps: -Install cygwin. -Use setup.exe in the cygwin folder to install the following packages:

-devel → openssl

-devel → g++-gcc

-devel → make

-python → python

-devel → git

-Open the cygwin command line with Start > Cygwin > Cygwin Bash Shell. -Run the below commands to download and build node.
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

Hello Node.js!

Here's a quick program to make sure everything is up and running correctly:
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
Run the code with the node command line utility:
> node hello_node.js
Server running at http://127.0.0.1:8124/
Now, if you navigate to http://127.0.0.1:8124/ in your browser, you should see a nice message.
 
For indepth understanding click on
 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox